import React from 'react';
import { withRouter } from 'react-router-dom';
import DyComponent from '@/components/dynamic-components/DyComponent';

interface IProps {
  history: any;
}

function Demo(props: IProps) {
  function gotoDetail(id: string) {
    props.history.push(`/demo/detail/${id}`);
  }

  const data = {
    name: 'test',
    remark: 'remark'
  };
  return (
    <div>
      <h1>Demo</h1>
      <p onClick={() => gotoDetail('1')}>detail-1</p>
      <p onClick={() => gotoDetail('2')}>detail-2</p>
      <DyComponent name='DyComponentTest'></DyComponent>
      <DyComponent name='DyComponentTest1' data={data}></DyComponent>
    </div>
  );
}

export default withRouter(Demo);
